package org.afi.mushroomplayer.utils;

import org.afi.mushroomplayer.model.SongInfo;


public class FileWrapper implements Comparable<FileWrapper> {

	private SongInfo info;
	private int type;

	public FileWrapper(SongInfo info, int type) {
		this.info = info;
		this.type = type;
	}

	@Override
	public int compareTo(FileWrapper another) {
		int result = 0;
		switch (type) {
		case 1:// type: title
			result = info.getTitle().compareTo(another.getSongInfo().getTitle());
			break;
		case 2:// type: artist
			result = info.getArtist().compareTo(another.getSongInfo().getArtist());
			break;
		case 3:// type: album
			result = info.getAlbum().compareTo(another.getSongInfo().getAlbum());
			break;
		}

		if (result > 0) {
			return 1;
		} else if (result < 0) {
			return -1;
		} else
			return 0;
	}

	public SongInfo getSongInfo() {
		return this.info;
	}
}
